home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Shape Smash / shape-smash.swf / scripts / Code / FIELD / helpers / _dm218.as next >
Encoding:
Text File  |  2010-05-14  |  5.3 KB  |  199 lines

  1. package Code.FIELD.helpers
  2. {
  3.    import Code.FIELD._dq803;
  4.    import Code.FIELD.body._kc461;
  5.    import Code.FIELD.body._wx790;
  6.    import Code.LIB._rs402;
  7.    import Code.OPTIONS._gs337;
  8.    import flash.display.Shape;
  9.    import flash.events.Event;
  10.    import flash.events.MouseEvent;
  11.    import flash.filters.BitmapFilterQuality;
  12.    import flash.filters.GlowFilter;
  13.    import flash.geom.Point;
  14.    
  15.    public class _dm218
  16.    {
  17.       public static const stNone:int = 0;
  18.       
  19.       public static const stSelected:int = 1;
  20.       
  21.       public var iOff:Boolean = false;
  22.       
  23.       private var iField:_dq803;
  24.       
  25.       private var iBrunch:Array;
  26.       
  27.       private var iTarget:_kc461;
  28.       
  29.       private var iTimer:int;
  30.       
  31.       private var iState:int;
  32.       
  33.       private var iShape:_kc461;
  34.       
  35.       public function _dm218(param1:_dq803)
  36.       {
  37.          iOff = false;
  38.          super();
  39.          iField = param1;
  40.          iBrunch = new Array();
  41.          iField.addEventListener(MouseEvent.MOUSE_MOVE,_up587);
  42.          iField.addEventListener(Event.ENTER_FRAME,onEnterFrame);
  43.          iField.addEventListener(MouseEvent.MOUSE_OUT,_up587);
  44.          iField.addEventListener(MouseEvent.MOUSE_OVER,_up587);
  45.       }
  46.       
  47.       private function setSelection(param1:_kc461, param2:Boolean) : void
  48.       {
  49.          var _loc3_:GlowFilter = null;
  50.          if(param2 == false)
  51.          {
  52.             param1._pr238.m_userData.display.filters = null;
  53.          }
  54.          else
  55.          {
  56.             _loc3_ = new GlowFilter(_gs337.cWhite);
  57.             _loc3_.blurX = _loc3_.blurY = 3 * _rs402._oy577;
  58.             _loc3_.color = 16777215;
  59.             _loc3_.strength = 2.4;
  60.             _loc3_.quality = BitmapFilterQuality.HIGH;
  61.             _loc3_.inner = true;
  62.             param1._pr238.m_userData.display.filters = [_loc3_];
  63.          }
  64.       }
  65.       
  66.       public function get brunch() : Array
  67.       {
  68.          if(iBrunch)
  69.          {
  70.             return iBrunch.slice(0,iBrunch.length);
  71.          }
  72.          return [];
  73.       }
  74.       
  75.       private function _he665() : void
  76.       {
  77.          var _loc1_:Point = null;
  78.          var _loc2_:Point = null;
  79.          var _loc3_:Array = null;
  80.          var _loc4_:int = 0;
  81.          var _loc5_:Object = null;
  82.          iTarget = null;
  83.          _loc1_ = new Point(iField.mouseX,iField.mouseY);
  84.          _loc2_ = iField.localToGlobal(_loc1_);
  85.          _loc3_ = iField.getObjectsUnderPoint(_loc2_);
  86.          _loc4_ = 0;
  87.          while(_loc4_ < _loc3_.length)
  88.          {
  89.             _loc5_ = _loc3_[_loc4_];
  90.             if(_loc5_ is Shape)
  91.             {
  92.                if(_loc5_.parent.parent is _wx790)
  93.                {
  94.                   iTarget = _wx790(_loc5_.parent.parent).iShape;
  95.                }
  96.             }
  97.             _loc4_++;
  98.          }
  99.       }
  100.       
  101.       private function _yx620(param1:Boolean) : void
  102.       {
  103.          var _loc2_:int = 0;
  104.          var _loc3_:_kc461 = null;
  105.          _loc2_ = 0;
  106.          while(_loc2_ < iBrunch.length)
  107.          {
  108.             _loc3_ = iBrunch[_loc2_];
  109.             setSelection(_loc3_,param1);
  110.             _loc2_++;
  111.          }
  112.          if(param1 == false)
  113.          {
  114.             iBrunch = null;
  115.          }
  116.       }
  117.       
  118.       public function _dx150() : void
  119.       {
  120.          iField.removeEventListener(MouseEvent.MOUSE_MOVE,_up587);
  121.          iField.removeEventListener(Event.ENTER_FRAME,onEnterFrame);
  122.          iField.removeEventListener(MouseEvent.MOUSE_OUT,_up587);
  123.          iField.removeEventListener(MouseEvent.MOUSE_OVER,_up587);
  124.       }
  125.       
  126.       public function _up587(param1:MouseEvent) : void
  127.       {
  128.          var _loc2_:_kc461 = null;
  129.          if(iOff)
  130.          {
  131.             return;
  132.          }
  133.          if(param1.target is _wx790)
  134.          {
  135.             _loc2_ = _wx790(param1.target).iShape;
  136.             if(iShape != _loc2_)
  137.             {
  138.                iShape = _loc2_;
  139.                iTimer = 30;
  140.                iState = stSelected;
  141.             }
  142.          }
  143.          else if(iBrunch)
  144.          {
  145.             _yx620(false);
  146.             iShape = null;
  147.             iState = stNone;
  148.          }
  149.       }
  150.       
  151.       public function onEnterFrame(param1:Event) : void
  152.       {
  153.          var _loc2_:Array = null;
  154.          if(iOff)
  155.          {
  156.             return;
  157.          }
  158.          _he665();
  159.          switch(iState)
  160.          {
  161.             case stNone:
  162.                if(iTarget)
  163.                {
  164.                   iTimer = 6;
  165.                   iShape = iTarget;
  166.                   iState = stSelected;
  167.                }
  168.                break;
  169.             case stSelected:
  170.                if(++iTimer > 6)
  171.                {
  172.                   _loc2_ = iField.iWorld.iContactSolver._hd293(iShape);
  173.                   iTimer = 0;
  174.                   if(_loc2_.length >= 3)
  175.                   {
  176.                      _le236(_loc2_);
  177.                   }
  178.                   else if(iBrunch)
  179.                   {
  180.                      _yx620(false);
  181.                   }
  182.                }
  183.          }
  184.       }
  185.       
  186.       public function _le236(param1:Array) : void
  187.       {
  188.          if(iBrunch)
  189.          {
  190.             _yx620(false);
  191.          }
  192.          iBrunch = param1;
  193.          _yx620(true);
  194.          iState = stSelected;
  195.       }
  196.    }
  197. }
  198.  
  199.